import Vue from 'vue'
import Vuex from 'vuex'
import App from './App'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/css/base.css'
import axios from 'axios'

Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(Vuex);
Vue.prototype.$axios = axios;
axios.defaults.baseURL = 'http://localhost:8090'
axios.defaults.timeout = 5000

axios.interceptors.request.use(function(config) {
    let token = window.sessionStorage.getItem("token")
    if (token) {
        config.headers.token = token;
    }
    return config;
}, function(error) {
    // 对请求错误做些什么
    return Promise.reject(error);
});

new Vue({
    el: '#app',
    router,
    store,
    components: { App },
    template: '<App/>'
})
